package dao

import (
	"context"
	"gorm.io/gorm"
	"sale-admin/config/mysql"
	"sale-admin/internal/dal"
)

func getCommonQuery(in any) *dal.Query {
	if db, ok := in.(*gorm.DB); ok {
		return dal.Use(db)
	}
	ctx := in.(context.Context)
	return dal.Use(mysql.NewDB().WithContext(ctx))
}
